<!DOCTYPE html>
<html>

	<head>
		<meta charset="UTF-8">
		<title>Insert title here</title>
		<link rel="stylesheet" href="../../lib/layui/css/layui.css" media="all">
	</head>

	<body>
		<form class="layui-form">
				<div class="layui-form-item" style="width: 300px;">
					<label class="layui-form-label">选择框<span style="color: red;">*</span></label>
					<div class="layui-input-block">
						<select name="city" lay-verify="required">
							<option value=""></option>s
							<option value="0">1</option>
							<option value="1">2</option>
						</select>
					</div>
				</div>
				<div class="layui-form-item">
				<label class="layui-form-label"><span style="color: red;">*</span>
				商品名称</label>
				<div class="layui-input-inline">
					<input type="text" name="product_name" id="product_name" required lay-verify="required" placeholder="请输入" autocomplete="off" class="layui-input">
				</div>
				</div>
				<div class="layui-form-item">
				<label class="layui-form-label"><span style="color: red;">*</span>
				商品数量</label>
				<div class="layui-input-inline">
					<input type="text" name="inventory_quantity" id="inventory_quantity" required lay-verify="required" placeholder="请输入" autocomplete="offinventory_quantity" class="layui-input">
				</div>
				</div>
			</div>
			<div class="layui-form-item">
				<div class="layui-input-block">
					<button class="layui-btn" lay-submit lay-filter="formDemo">立即添加</button>
				</div>
			</div>
		</form>
	</body>
	<script type="text/javascript" src="js/User.js"></script>
	<script src="../../layui/layui.js"></script>
	<script>
		layui.use(['form', 'upload'], function() {
			var form = layui.form;
			var upload = layui.upload;
			var $ = layui.jquery;
			form.on('submit(formDemo)', function(data) {
				var d = data.field;
				d.method = "incentoryadd";
				console.log(d);
				var url = globalData.server + 'inventory/incentoryadd';
				$.post(url, d, function(data) {
					if(data.count > 0) {
						console.log('添加成功');
						var index = parent.layer.getFrameIndex(window.inventory_quantity);
						parent.layer.close(index);
					}
				}, "json");
				return false;
			});
		});
	</script>

</html>